package com.wrial.face.tencent;
/*
 * @Author  Wrial
 * @Date Created in 20:03 2020/8/23
 * @Description
 */

import java.util.Scanner;

public class DeleteKNode {


    public static Node deleteKNode(Node head, int k) {
        Node ans = head;
        for (int i = 0; i < k - 2; i++) {
            head = head.next;
        }
        head.next = head.next.next;
        return ans;
    }

    static class Node {
        int val;

        Node(int val) {
            this.val = val;
        }

        Node next;

    }

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int count = scanner.nextInt();
        Node head = new Node(-1);
        Node p = head;
        int k = scanner.nextInt();
        if (k>count) return;
        for (int i = 0; i < count; i++) {
            p.next = new Node(scanner.nextInt());
            p = p.next;
        }
        Node h = deleteKNode(head.next, k);
        while (h!=null){
            System.out.printf("%d ",h.val);
            h = h.next;
        }
    }
}
